import React, {useEffect} from 'react';
import {getFindByParentIdAsync, useSelectorDict} from "@/store/slices/dict";
import {useAppDispatch} from "@/hooks";
import {Table} from "antd";

function Dict() {
    const dispatch = useAppDispatch();
    const {dictList} = useSelectorDict();
    useEffect(()=>{
        dispatch(getFindByParentIdAsync(1));
    },[]);
    return (
        <Table
            columns={[
                {
                    title:"名称",
                    dataIndex:"name"
                },
                {
                    title:"编码",
                    dataIndex:"dictCode"
                },
                {
                    title:"值",
                    dataIndex:"value"
                },
                {
                    title:"创建时间",
                    dataIndex:"createTime"
                }
            ]}
            // 数组元素中的id属性值作为标识
            rowKey={"id"}
            // 数据源(数组）
            dataSource={dictList}
        ></Table>
    );
}

export default Dict;